home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dbase
/
techs.zip
/
TECH7.ZIP
/
CMDTOTAL.PRG
next >
Wrap
Text File
|
1985-11-01
|
934b
|
35 lines
* Program...: Cmdtotal.PRG
* Author... : Luis Castro
* Date .....: December 1, 1985
* Version ..: dBASE II, any version
* Note(s)...: This program TOTALS one database file to
* another database file in a way that is very
* similar to the dBASE II TOTAL command.
*
SET TALK OFF
* ---Mainfile should be either INDEXed or SORTed on the
* ---TOTALling key.
USE Mainfile
* ---Create TOTAL TO database file.
COPY STRUCTURE TO Newfile FIELDS Key, Field1, Field2
SELECT SECONDARY
USE Newfile
SELECT PRIMARY
DO WHILE .NOT. EOF
STORE key TO mkey
STORE 0 TO total1, total2
DO WHILE key = mkey .AND. ( .NOT. EOF )
STORE Field1 + total1 TO total1
STORE Field2 + total2 TO total2
SKIP
ENDDO
SELECT SECONDARY
APPEND BLANK
REPLACE Key WITH mkey
REPLACE Field1 WITH total1, Field2 WITH total2
SELECT PRIMARY
ENDDO
CLEAR
RETURN
* EOP Cmdupdat.PRG